import { Injectable } from '@angular/core';
import { HOSTURL, PREFIX } from '../../../config';
import { RequestClientService } from '../../request-client.service';
@Injectable({
    providedIn: 'root'
})

export class MemberService {

    constructor(
        private requestClientService: RequestClientService
    ) { }
    // 获取人员列表
    public async GetUsers(params?) {
        const res = await this.requestClientService.get(HOSTURL + `/api/services/${PREFIX}/User/GetUsers`, params);
        return res;
    }
    // 创建或编辑人员
    public async CreateOrUpdateUser(params?) {
        // tslint:disable-next-line: max-line-length
        const res = await this.requestClientService.post(HOSTURL + `/api/services/${PREFIX}/User/CreateOrUpdateUser`, params);
        return res;
    }
    // 重置默认密码
    public async ResetPasswordByAdmin(params?) {
        // tslint:disable-next-line: max-line-length
        const res = await this.requestClientService.post(HOSTURL + `/api/services/${PREFIX}/Account/ResetPasswordByAdmin?userId=` + params.userId, params);
        return res;
    }
    // 删除人员
    public async DeleteUser(params?) {
        // tslint:disable-next-line: max-line-length
        const res = await this.requestClientService.delete(HOSTURL + `/api/services/${PREFIX}/User/DeleteUser`, params);
        return res;
    }
    // 批量删除人员
    public async BatchDeleteUser(params?) {
        // tslint:disable-next-line: max-line-length
        const res = await this.requestClientService.post(HOSTURL + `/api/services/${PREFIX}/User/BatchDeleteUser`, params);
        return res;
    }
    // 更改人员状态
    public async UpdateActiveStatus(params?) {
        // tslint:disable-next-line: max-line-length
        const res = await this.requestClientService.put(HOSTURL + `/api/services/${PREFIX}/User/UpdateActiveStatus?userId=` + params.userId, params);
        return res;
    }
    // 日志页面 获取日志
    public async QueryRecentUserLoginAttemptsPagedList(params?) {
        // tslint:disable-next-line: max-line-length
        const res = await this.requestClientService.post(HOSTURL + `/api/services/${PREFIX}/UserLogin/QueryRecentUserLoginAttemptsPagedList`, params);
        return res;
    }
    // 获取所有权限点
       // 获取人员列表
       public async GetAllPermissions(params?) {
        const res = await this.requestClientService.get(HOSTURL + `/api/services/${PREFIX}/Permission/GetAllPermissions`, params);
        return res;
    }

}